import { ServiceManager } from './../../common/serviceFactory/serviceManager';
import * as Koa from 'koa';
import { route, RouteOptionsVerify } from "../../common";
import { ComponentService } from '../../service/comService';
const comSvr = ServiceManager.Current.GetService<ComponentService>('ComponentService');
class ComponentController {
    @route(new RouteOptionsVerify('GET', '/api/component'))
    async queryComponents(ctx: Koa.Context, next) {
        let p = ctx.query;
        ctx.response.body = await comSvr.QueryComponet(p);
        await next();
    }
    @route(new RouteOptionsVerify('GET', '/api/component/:id'))
    async getComponentInfoById(ctx: Koa.Context, next) {
        ctx.response.body = null;
        await next();
    }
    @route(new RouteOptionsVerify('POST', '/api/component'))
    async createComponent(ctx: Koa.Context, next) {
        ctx.response.body = null;
        await next();
    }
    @route(new RouteOptionsVerify('PUT', '/api/component'))
    async updateComponent(ctx: Koa.Context, next) {
        ctx.response.body = null;
        await next();
    }
    @route(new RouteOptionsVerify('DELETE', '/api/component'))
    async deleteComponent(ctx: Koa.Context, next) {
        ctx.response.body = null;
        await next();
    }

    @route(new RouteOptionsVerify('GET', '/api/tmpComItem/:id'))
    async getTmpComItemById(ctx: Koa.Context, next) {
        const { id } = ctx.params;
        ctx.response.body = await comSvr.GetTmpComItemById(id);
        await next();
    }
}